#include "Sample.h"

#include <cstring>

string Sample::toString() {
    stringstream ss;
    ss << m_class;
    ss << ":";
    for (int i = 0; i < m_dim; i++) {
        ss << " " << m_feature[i];
    }

    return ss.str();
}

void Sample::assignFeature(float *data) {
    if (data == NULL) {
        memset(m_feature, 0, m_dim*sizeof(float));
        return;
    }

    memcpy(m_feature, data, m_dim*sizeof(float));
}
